<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>CKEditor 5 - Classic editor</title>
    <!--<script src="https://cdn.ckeditor.com/ckeditor5/12.1.0/classic/ckeditor.js"></script>-->
    <script src="../lib/ckeditor.js"></script>
</head>
<body>
<h1>Classic editor</h1>
<textarea name="content" id="editor">
            &lt;p&gt;This is some sample content.&lt;/p&gt;
        </textarea>
<p><input type="submit" value="Submit" onclick="getDataClick()"></p>
<script>
    //    ClassicEditor.create(document.querySelector('#editor'))
    //            .catch(error = > {
    //        console.error(error);
    //    } )
    //    ;
    let editor;

    ClassicEditor
            .create(document.querySelector('#editor'))
            .then(newEditor => {
                editor = newEditor;
            })
            .catch(error => {
                console.error(error);
            });

    function getDataClick() {
        const editorData = editor.getData();
        console.log("data=" + editorData);
        alert(editorData);
    }
</script>
</body>
</html>